package com.itboye.sunsunhome.www.aq.base;

import android.app.NotificationManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import com.igexin.sdk.PushConsts;
import com.itboye.sunsunhome.www.aq.AqMessageNotification;

/**
 * Created by 赵武 on 2015/4/2.
 */
public class PushDemoReceiver extends BroadcastReceiver {
	@Override
	public void onReceive(Context context, Intent intent) {
		Bundle bundle = intent.getExtras();
		System.out.println(bundle+">>>>>>>>>>>>>>>>>>>");
		switch (bundle.getInt(PushConsts.CMD_ACTION)) {
		case PushConsts.GET_MSG_DATA:
			// 获取透传（payload）数据
			byte[] payload = bundle.getByteArray("payload");
			if (payload != null) {
				try {
					String data = new String(payload);
					AqMessageNotification.notify(context, data, 0);
				} catch (Exception e) {
				}
			}
			break;
		default:
			break;
		}
	}
}
